#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>

int compare (const void *a, const void *b)
{
    return (*(int *)a) - (*(int *)b);
}

int main ()
{
    int arr[] = {10, 7, 9, 4, 1, 3, 5, 6, 2, 8};
    printf("before qsort: ");
    for (size_t i = 0; i < sizeof(arr) / sizeof(int); i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");
    qsort(arr, sizeof(arr) / sizeof(int), sizeof(int), compare);
    printf("after qsort: ");
    for (size_t i = 0; i < sizeof(arr) / sizeof(int); i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");    
    return 0;
}